package org.smart.framework.core.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @author lyric
 * @version 1.0.0
 * @date 2017/2/8 14:20
 * @description 字符串工具类
 */
public final class StringUtil {

    /** 字符串分隔符 */
    public static final String SEPARATOR = String.valueOf((char) 29);

    /**
     * @author lyric
     * @description 字符串是否为空
     * @param str
     * @return
     */
    public static boolean isEmpty(String str) {
        if (null != str) {
            str = str.trim();
        }
        return StringUtils.isEmpty(str);
    }

    /**
     * @author lyric
     * @description 字符串是否非空
     * @param str
     * @return
     */
    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }

    /**
     * @author lyric
     * @description 分割固定格式的字符串
     * @param str 待分割字符串
     * @param separator 分隔符
     * @return
     */
    public static String[] splitString(String str, String separator) {
        return StringUtils.splitByWholeSeparator(str, separator);
    }
}
